use std::cell::Cell;
use std::rc::Rc;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use std::collections::HashMap;
use web_sys::DomParser;
use web_sys::SupportedType;
use web_sys::NamedNodeMap;
use web_sys::Attr;
use std::sync::Mutex; 
use std::error::Error;
use std::fs::File;
use std::io::Read;
use std::time::{SystemTime, UNIX_EPOCH};

// When the `wee_alloc` feature is enabled, this uses `wee_alloc` as the global
// allocator.
//
// If you don't want to use `wee_alloc`, you can safely delete this.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;

#[macro_use]
extern crate lazy_static; 
include!("facecat.rs");

#[wasm_bindgen]
extern {
    fn alert(s: &str);
}

#[wasm_bindgen]
extern {
	#[wasm_bindgen(js_namespace = console)]
    fn log(s: &str);
}

/*
* Paint event
* context:Drawing context
* view:View
* clip_rect:Crop area
*/
pub fn on_paint(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, clip_rect:FCRect){
	on_paint_default(context, view.clone(), clip_rect.clone());
}

/*
* Paint border event
* context:Drawing context
* view:View
* clip_rect:Crop area
*/
pub fn on_paint_border(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, clip_rect:FCRect){
	on_paint_border_default(context, view.clone(), clip_rect.clone());
}

/*
* Mouse down event
* context:Drawing context
* view:View
* mp:Coordinate
* buttons:Buttons
* clicks:Click count
* delta:Delta
*/
pub fn on_mouse_down(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, mp:FCPoint, buttons:i32, clicks:i32, delta:i32){
	on_mouse_down_default(context, view.clone(), mp.clone(), buttons, clicks, delta);
}

/*
* Mouse move event
* context:Drawing context
* view:View
* mp:Coordinate
* buttons:Buttons
* clicks:Click count
* delta:Delta
*/
pub fn on_mouse_move(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, mp:FCPoint, buttons:i32, clicks:i32, delta:i32){
	on_mouse_move_default(context, view.clone(), mp.clone(), buttons, clicks, delta);
}

/*
* Mouse up event
* context:Drawing context
* view:View
* mp:Coordinate
* buttons:Buttons
* clicks:Click count
* delta:Delta
*/
pub fn on_mouse_up(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, mp:FCPoint, buttons:i32, clicks:i32, delta:i32){
	on_mouse_up_default(context, view.clone(), mp.clone(), buttons, clicks, delta);
}

/*
* Click event
* context:Drawing context
* view:View
* first_touch:Coordinate
* first_point:Buttons
* second_touch:Click count
* second_point:Delta
*/
pub fn on_click(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, first_touch:bool, first_point:FCPoint, second_touch:bool, second_point:FCPoint, clicks:i32){
	on_click_default(context, view.clone(), first_touch, first_point.clone(), second_touch, second_point.clone(), clicks);
}

/*
* Mouse wheel event
* context:Drawing context
* view:View
* mp:Coordinate
* buttons:Buttons
* clicks:Click count
* delta:Delta
*/
pub fn on_mouse_wheel(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, mp:FCPoint, buttons:i32, clicks:i32, delta:i32){
	on_mouse_wheel_default(context, view.clone(), mp.clone(), buttons, clicks, delta);
}

/*
* Touch start event
* context:Drawing context
* view:View
* first_touch:Coordinate
* first_point:Buttons
* second_touch:Click count
* second_point:Delta
*/
pub fn on_touch_start(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, first_touch:bool, first_point:FCPoint, second_touch:bool, second_point:FCPoint){
	on_touch_start_default(context, view.clone(), first_touch, first_point.clone(), second_touch, second_point.clone());
}

/*
* Touch move event
* context:Drawing context
* view:View
* first_touch:Coordinate
* first_point:Buttons
* second_touch:Click count
* second_point:Delta
*/
pub fn on_touch_move(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, first_touch:bool, first_point:FCPoint, second_touch:bool, second_point:FCPoint){
	on_touch_move_default(context, view.clone(), first_touch, first_point.clone(), second_touch, second_point.clone());
}

/*
* Touch end event
* context:Drawing context
* view:View
* first_touch:Coordinate
* first_point:Buttons
* second_touch:Click count
* second_point:Delta
*/
pub fn on_touch_end(context:&std::rc::Rc<web_sys::CanvasRenderingContext2d>, view:FCView, first_touch:bool, first_point:FCPoint, second_touch:bool, second_point:FCPoint){
	on_touch_end_default(context, view.clone(), first_touch, first_point.clone(), second_touch, second_point.clone());
}

/*
* Get price color
*/
pub fn get_price_color(price:f64, compare_price:f64)->String{
	if price != 0.0
	{
		if price > compare_price
		{
			return "rgb(255,82,82)".to_string();
		}
		else if price < compare_price
		{
			return "rgb(46,255,50)".to_string();
		}
	}
	return "rgb(190,190,235)".to_string();
}

/*
* Add chart
*/
pub fn add_chart(my_chart:FCView, cycle:i32){
	let mut security_datas:Vec<SecurityData> = Vec::new();
	if cycle >= 1440{
		let data = "2024-08-27,8.890000,9.130000,8.830000,9.100000,217449974.000000,2011545728.000000 2024-08-28,9.030000,9.130000,8.900000,8.960000,136048440.000000,1254670848.000000 2024-08-29,8.920000,8.940000,8.620000,8.680000,145857294.000000,1305475840.000000 2024-08-30,8.680000,8.820000,8.580000,8.710000,154953168.000000,1385639936.000000 2024-09-02,8.630000,8.850000,8.480000,8.790000,145210793.000000,1300193664.000000 2024-09-03,8.760000,8.820000,8.450000,8.490000,164742300.000000,1443072128.000000 2024-09-04,8.270000,8.270000,7.950000,8.030000,234215259.000000,1939150976.000000 2024-09-05,7.990000,8.060000,7.830000,7.910000,165342472.000000,1342872192.000000 2024-09-06,7.890000,7.990000,7.820000,7.820000,111047936.000000,901374528.000000 2024-09-09,7.770000,7.780000,7.490000,7.600000,183015842.000000,1428680704.000000 2024-09-10,7.630000,7.730000,7.600000,7.680000,125534650.000000,989432384.000000 2024-09-11,7.500000,7.550000,7.330000,7.530000,202397741.000000,1545930368.000000 2024-09-12,7.510000,7.650000,7.470000,7.620000,133186801.000000,1037762176.000000 2024-09-13,7.660000,7.760000,7.660000,7.680000,129717192.000000,1029572480.000000 2024-09-18,7.690000,7.880000,7.690000,7.840000,117442200.000000,941347776.000000 2024-09-19,7.900000,7.900000,7.700000,7.850000,115368818.000000,899950272.000000 2024-09-20,7.890000,8.010000,7.830000,7.910000,133488080.000000,1058130240.000000 2024-09-23,7.910000,8.090000,7.860000,8.010000,96586600.000000,772046976.000000 2024-09-24,8.110000,8.370000,8.040000,8.360000,183936323.000000,1513319680.000000 2024-09-25,8.510000,8.660000,8.370000,8.400000,212473516.000000,1805556480.000000 2024-09-26,8.300000,8.450000,8.250000,8.390000,295752968.000000,2464797440.000000 2024-09-27,8.390000,8.400000,8.280000,8.380000,179409373.000000,1496451840.000000 2024-09-30,8.530000,9.170000,8.530000,9.020000,540926208.000000,4758267392.000000 2024-10-08,9.920000,9.920000,8.900000,9.340000,642985322.000000,6034716160.000000 2024-10-09,9.100000,9.130000,8.450000,8.450000,444901825.000000,3873797888.000000 2024-10-10,8.470000,9.010000,8.470000,8.740000,393485553.000000,3451721216.000000 2024-10-11,8.850000,8.890000,8.630000,8.700000,251485184.000000,2204109056.000000 2024-10-14,8.700000,8.840000,8.620000,8.750000,221455125.000000,1934312192.000000 2024-10-15,8.580000,8.610000,8.420000,8.430000,225516656.000000,1918310016.000000 2024-10-16,8.400000,8.500000,8.320000,8.420000,166912034.000000,1404550528.000000 2024-10-17,8.410000,8.590000,8.350000,8.350000,179804141.000000,1522345216.000000 2024-10-18,8.390000,8.600000,8.350000,8.540000,240218336.000000,2036682496.000000 2024-10-21,8.500000,8.590000,8.410000,8.460000,229254626.000000,1942472448.000000 2024-10-22,8.460000,8.510000,8.430000,8.460000,167043506.000000,1414903168.000000 2024-10-23,8.500000,8.530000,8.430000,8.480000,195556528.000000,1657075968.000000 2024-10-24,8.460000,8.470000,8.380000,8.450000,97837261.000000,825453440.000000 2024-10-25,8.410000,8.450000,8.380000,8.390000,121897008.000000,1024342016.000000 2024-10-28,8.330000,8.370000,8.180000,8.370000,226008481.000000,1865061248.000000 2024-10-29,8.290000,8.330000,8.200000,8.200000,159037556.000000,1313118592.000000 2024-10-30,8.200000,8.250000,8.080000,8.110000,158425431.000000,1290071552.000000 2024-10-31,8.130000,8.160000,8.060000,8.100000,128310150.000000,1039938560.000000 2024-11-01,8.130000,8.380000,8.110000,8.300000,280524672.000000,2322035712.000000 2024-11-04,8.310000,8.340000,8.130000,8.200000,194985482.000000,1593503744.000000 2024-11-05,8.200000,8.290000,8.140000,8.280000,203694483.000000,1676962432.000000 2024-11-06,8.230000,8.400000,8.220000,8.260000,237345722.000000,1969970816.000000 2024-11-07,8.220000,8.350000,8.160000,8.350000,244681056.000000,2019718784.000000 2024-11-08,8.350000,8.390000,8.220000,8.250000,206159231.000000,1710854016.000000 2024-11-11,8.200000,8.200000,8.020000,8.090000,248767811.000000,2009778944.000000 2024-11-12,8.030000,8.160000,7.990000,8.000000,213088944.000000,1716917888.000000 2024-11-13,7.990000,8.160000,7.970000,8.070000,223318088.000000,1803260160.000000 2024-11-14,8.030000,8.150000,8.020000,8.030000,185058127.000000,1497145344.000000 2024-11-15,8.030000,8.100000,7.980000,8.030000,185354700.000000,1489484687.000000".to_string();
		let str_split:Vec<&str> = data.split(" ").collect();
		for i in 0..str_split.len(){
			let sub_str = str_split[i];
			let sub_str_split:Vec<&str> = sub_str.split(",").collect();
			if sub_str_split.len() > 5{
				let mut s_data1:SecurityData = SecurityData::new();
				s_data1.volume = sub_str_split[5].to_string().parse::<f64>().unwrap() / 10000.0;
				s_data1.close = sub_str_split[4].to_string().parse::<f64>().unwrap();
				s_data1.high = sub_str_split[2].to_string().parse::<f64>().unwrap();
				s_data1.low = sub_str_split[3].to_string().parse::<f64>().unwrap();
				s_data1.open = sub_str_split[1].to_string().parse::<f64>().unwrap();
				s_data1.date = i as f64;
				security_datas.push(s_data1);
			}
		}
	}else{
		let mut data = "2024-11-14,0931,8.030000,8.070000,8.020000,8.070000,10006800.000000,80483528.000000 2024-11-14,0936,8.060000,8.110000,8.060000,8.090000,9868000.000000,79824778.000000 2024-11-14,0941,8.090000,8.100000,8.060000,8.060000,6935200.000000,56065703.000000 2024-11-14,0946,8.060000,8.080000,8.060000,8.080000,3621900.000000,29237761.000000 2024-11-14,0951,8.080000,8.100000,8.070000,8.070000,6060200.000000,48962493.000000 2024-11-14,0956,8.060000,8.080000,8.060000,8.070000,1700600.000000,13719996.000000 2024-11-14,1001,8.070000,8.100000,8.070000,8.090000,7739300.000000,62618762.000000 2024-11-14,1006,8.090000,8.110000,8.090000,8.100000,4825000.000000,39092107.000000 2024-11-14,1011,8.110000,8.110000,8.090000,8.110000,2979100.000000,24135704.000000 2024-11-14,1016,8.100000,8.110000,8.100000,8.100000,1772000.000000,14359776.000000 2024-11-14,1021,8.110000,8.110000,8.090000,8.100000,4390900.000000,35571672.000000 2024-11-14,1026,8.100000,8.110000,8.090000,8.100000,3561000.000000,28851972.000000 2024-11-14,1031,8.100000,8.150000,8.100000,8.140000,17404400.000000,141478754.000000 2024-11-14,1036,8.140000,8.150000,8.120000,8.120000,7768900.000000,63236777.000000 2024-11-14,1041,8.120000,8.130000,8.110000,8.130000,3501000.000000,28440141.000000 2024-11-14,1046,8.130000,8.140000,8.120000,8.130000,4911700.000000,39943707.000000 2024-11-14,1051,8.140000,8.140000,8.130000,8.130000,5049800.000000,41093010.000000 2024-11-14,1056,8.130000,8.140000,8.120000,8.130000,2050900.000000,16680356.000000 2024-11-14,1101,8.140000,8.140000,8.120000,8.130000,1444000.000000,11739776.000000 2024-11-14,1106,8.130000,8.130000,8.120000,8.130000,730700.000000,5938157.000000 2024-11-14,1111,8.120000,8.140000,8.120000,8.130000,2168800.000000,17634304.000000 2024-11-14,1116,8.140000,8.140000,8.130000,8.140000,1221700.000000,9938398.000000 2024-11-14,1121,8.130000,8.140000,8.120000,8.130000,1224500.000000,9950871.000000 2024-11-14,1126,8.130000,8.130000,8.120000,8.130000,991400.000000,8053527.000000 2024-11-14,1301,8.120000,8.130000,8.120000,8.120000,3388100.000000,27508768.000000 2024-11-14,1306,8.120000,8.130000,8.100000,8.110000,2564500.000000,20816128.000000 2024-11-14,1311,8.110000,8.110000,8.090000,8.100000,2909600.000000,23567694.000000 2024-11-14,1316,8.100000,8.110000,8.090000,8.100000,1892400.000000,15333903.000000 2024-11-14,1321,8.100000,8.110000,8.090000,8.110000,1530600.000000,12400845.000000 2024-11-14,1326,8.100000,8.110000,8.090000,8.100000,1899900.000000,15390893.000000 2024-11-14,1331,8.100000,8.100000,8.080000,8.100000,3333400.000000,26962272.000000 2024-11-14,1336,8.100000,8.100000,8.080000,8.080000,2091600.000000,16916298.000000 2024-11-14,1341,8.090000,8.090000,8.080000,8.080000,2035900.000000,16453914.000000 2024-11-14,1346,8.090000,8.100000,8.080000,8.090000,2089100.000000,16890870.000000 2024-11-14,1351,8.090000,8.090000,8.070000,8.070000,1344000.000000,10860343.000000 2024-11-14,1356,8.070000,8.090000,8.060000,8.090000,4057700.000000,32767285.000000 2024-11-14,1401,8.080000,8.090000,8.070000,8.070000,1334900.000000,10784051.000000 2024-11-14,1406,8.070000,8.080000,8.070000,8.070000,3060200.000000,24703351.000000 2024-11-14,1411,8.080000,8.080000,8.070000,8.080000,1185500.000000,9571909.000000 2024-11-14,1416,8.080000,8.080000,8.060000,8.060000,2516600.000000,20306099.000000 2024-11-14,1421,8.060000,8.070000,8.050000,8.060000,4327400.000000,34888061.000000 2024-11-14,1426,8.060000,8.070000,8.050000,8.060000,2793600.000000,22507991.000000 2024-11-14,1431,8.070000,8.070000,8.050000,8.060000,2613500.000000,21069202.000000 2024-11-14,1436,8.060000,8.060000,8.040000,8.050000,5423000.000000,43654568.000000 2024-11-14,1441,8.040000,8.060000,8.040000,8.060000,3155400.000000,25392116.000000 2024-11-14,1446,8.060000,8.060000,8.040000,8.040000,3615100.000000,29099021.000000 2024-11-14,1451,8.040000,8.050000,8.030000,8.030000,8725400.000000,70123412.000000 2024-11-14,1456,8.040000,8.050000,8.030000,8.030000,5242900.000000,42124361.000000 2024-11-15,0931,8.030000,8.050000,7.980000,8.000000,18553900.000000,148520519.000000 2024-11-15,0936,8.000000,8.010000,7.980000,8.000000,9534700.000000,76187911.000000 2024-11-15,0941,8.000000,8.030000,7.990000,8.030000,4237500.000000,33905325.000000 2024-11-15,0946,8.020000,8.050000,8.010000,8.040000,5632300.000000,45256489.000000 2024-11-15,0951,8.040000,8.040000,8.020000,8.030000,3620100.000000,29078699.000000 2024-11-15,0956,8.030000,8.070000,8.030000,8.050000,4520100.000000,36399024.000000 2024-11-15,1001,8.060000,8.070000,8.040000,8.050000,4863300.000000,39179887.000000 2024-11-15,1006,8.050000,8.050000,8.020000,8.030000,3419000.000000,27467143.000000 2024-11-15,1011,8.030000,8.040000,8.020000,8.040000,4216100.000000,33831428.000000 2024-11-15,1016,8.040000,8.040000,8.020000,8.030000,1609500.000000,12931719.000000 2024-11-15,1021,8.040000,8.040000,8.020000,8.040000,2545400.000000,20432533.000000 2024-11-15,1026,8.030000,8.050000,8.030000,8.040000,2546600.000000,20470464.000000 2024-11-15,1031,8.030000,8.050000,8.030000,8.040000,2777300.000000,22321961.000000 2024-11-15,1036,8.040000,8.040000,8.020000,8.020000,3328600.000000,26716744.000000 2024-11-15,1041,8.020000,8.030000,8.010000,8.020000,4525100.000000,36253701.000000 2024-11-15,1046,8.010000,8.040000,8.010000,8.020000,2061800.000000,16543283.000000 2024-11-15,1051,8.020000,8.040000,8.020000,8.030000,1046800.000000,8407691.000000 2024-11-15,1056,8.030000,8.050000,8.030000,8.040000,3178300.000000,25562137.000000 2024-11-15,1101,8.040000,8.040000,8.020000,8.020000,1454500.000000,11677943.000000 2024-11-15,1106,8.020000,8.040000,8.020000,8.020000,1387400.000000,11138508.000000 2024-11-15,1111,8.020000,8.030000,8.020000,8.030000,1125000.000000,9028263.000000 2024-11-15,1116,8.030000,8.030000,8.010000,8.020000,2267900.000000,18195524.000000 2024-11-15,1121,8.010000,8.020000,8.000000,8.010000,3207700.000000,25688799.000000 2024-11-15,1126,8.010000,8.020000,8.000000,8.010000,1678700.000000,13444290.000000 2024-11-15,1301,8.010000,8.020000,7.980000,8.000000,8370900.000000,66938277.000000 2024-11-15,1306,8.000000,8.010000,7.990000,8.010000,2035200.000000,16281724.000000 2024-11-15,1311,8.010000,8.010000,7.990000,8.000000,1876300.000000,15010673.000000 2024-11-15,1316,8.000000,8.010000,7.990000,8.000000,1267800.000000,10141467.000000 2024-11-15,1321,8.010000,8.020000,8.000000,8.010000,2232900.000000,17893408.000000 2024-11-15,1326,8.020000,8.030000,8.010000,8.020000,2191600.000000,17581505.000000 2024-11-15,1331,8.030000,8.060000,8.030000,8.060000,6561300.000000,52762833.000000 2024-11-15,1336,8.050000,8.080000,8.050000,8.070000,7982400.000000,64367823.000000 2024-11-15,1341,8.070000,8.080000,8.060000,8.060000,4909500.000000,39633011.000000 2024-11-15,1346,8.060000,8.080000,8.050000,8.070000,3862500.000000,31155045.000000 2024-11-15,1351,8.070000,8.100000,8.070000,8.090000,9260800.000000,74895770.000000 2024-11-15,1356,8.080000,8.090000,8.080000,8.090000,3122200.000000,25251554.000000 2024-11-15,1401,8.080000,8.080000,8.060000,8.070000,2037800.000000,16452412.000000 2024-11-15,1406,8.070000,8.080000,8.060000,8.070000,2633100.000000,21258962.000000 2024-11-15,1411,8.070000,8.080000,8.060000,8.060000,2603100.000000,21003366.000000 2024-11-15,1416,8.060000,8.080000,8.060000,8.070000,2958000.000000,23874167.000000 2024-11-15,1421,8.070000,8.080000,8.060000,8.060000,2321900.000000,18738794.000000 2024-11-15,1426,8.060000,8.080000,8.060000,8.070000,2842500.000000,22943334.000000 2024-11-15,1431,8.060000,8.070000,8.050000,8.060000,3478900.000000,28049904.000000 2024-11-15,1436,8.070000,8.080000,8.050000,8.060000,3323000.000000,26806081.000000 2024-11-15,1441,8.060000,8.070000,8.050000,8.060000,2111000.000000,17012411.000000 2024-11-15,1446,8.050000,8.060000,8.040000,8.050000,3552500.000000,28593920.000000 2024-11-15,1451,8.040000,8.050000,8.030000,8.030000,5819200.000000,46756724.000000 2024-11-15,1456,8.020000,8.040000,8.020000,8.030000,4662700.000000,37441538.000000".to_string();
		if(cycle == 0){
			data = "2024-11-15,0931,8.030000,8.050000,7.980000,7.990000,8183200.000000,65595596.000000 2024-11-15,0932,7.990000,8.020000,7.980000,8.010000,3376400.000000,26973092.000000 2024-11-15,0933,8.000000,8.010000,8.000000,8.010000,2976600.000000,23809172.000000 2024-11-15,0934,8.010000,8.010000,8.000000,8.000000,1910800.000000,15286927.000000 2024-11-15,0935,8.000000,8.010000,7.990000,8.000000,2106900.000000,16855732.000000 2024-11-15,0936,8.000000,8.000000,7.980000,7.980000,3155400.000000,25205976.000000 2024-11-15,0937,7.980000,8.000000,7.980000,7.990000,1302500.000000,10411905.000000 2024-11-15,0938,8.000000,8.010000,7.980000,7.980000,2341300.000000,18716104.000000 2024-11-15,0939,7.980000,7.990000,7.980000,7.990000,1798800.000000,14363796.000000 2024-11-15,0940,7.990000,8.010000,7.990000,8.000000,936700.000000,7490130.000000 2024-11-15,0941,8.000000,8.000000,7.990000,8.000000,879100.000000,7029629.000000 2024-11-15,0942,8.000000,8.010000,7.990000,8.000000,674200.000000,5390437.000000 2024-11-15,0943,7.990000,8.000000,7.990000,8.000000,803900.000000,6424475.000000 2024-11-15,0944,8.000000,8.020000,7.990000,8.010000,1060300.000000,8484871.000000 2024-11-15,0945,8.020000,8.030000,8.010000,8.030000,820000.000000,6575913.000000 2024-11-15,0946,8.020000,8.030000,8.020000,8.030000,952600.000000,7644248.000000 2024-11-15,0947,8.010000,8.040000,8.010000,8.040000,889100.000000,7137789.000000 2024-11-15,0948,8.030000,8.050000,8.030000,8.050000,1469400.000000,11817169.000000 2024-11-15,0949,8.040000,8.050000,8.030000,8.040000,1667500.000000,13402686.000000 2024-11-15,0950,8.040000,8.040000,8.030000,8.040000,653700.000000,5254597.000000 2024-11-15,0951,8.040000,8.040000,8.030000,8.040000,1007800.000000,8093586.000000 2024-11-15,0952,8.030000,8.040000,8.020000,8.030000,532200.000000,4273931.000000 2024-11-15,0953,8.040000,8.040000,8.030000,8.040000,546400.000000,4388800.000000 2024-11-15,0954,8.040000,8.040000,8.030000,8.040000,369800.000000,2971884.000000 2024-11-15,0955,8.040000,8.040000,8.030000,8.030000,1163900.000000,9350498.000000 2024-11-15,0956,8.030000,8.050000,8.030000,8.040000,771000.000000,6199827.000000 2024-11-15,0957,8.040000,8.050000,8.040000,8.040000,568600.000000,4572209.000000 2024-11-15,0958,8.040000,8.070000,8.040000,8.060000,2457600.000000,19801928.000000 2024-11-15,0959,8.060000,8.060000,8.050000,8.050000,410100.000000,3304939.000000 2024-11-15,1000,8.060000,8.060000,8.050000,8.050000,312800.000000,2520121.000000 2024-11-15,1001,8.060000,8.070000,8.060000,8.070000,694000.000000,5594708.000000 2024-11-15,1002,8.070000,8.070000,8.050000,8.050000,1584300.000000,12769643.000000 2024-11-15,1003,8.050000,8.060000,8.040000,8.060000,1273100.000000,10256023.000000 2024-11-15,1004,8.060000,8.060000,8.050000,8.060000,323700.000000,2606571.000000 2024-11-15,1005,8.050000,8.050000,8.040000,8.050000,988200.000000,7952942.000000 2024-11-15,1006,8.050000,8.050000,8.030000,8.040000,824400.000000,6629386.000000 2024-11-15,1007,8.030000,8.050000,8.030000,8.040000,568000.000000,4565166.000000 2024-11-15,1008,8.040000,8.040000,8.030000,8.040000,548500.000000,4406488.000000 2024-11-15,1009,8.040000,8.040000,8.020000,8.030000,757800.000000,6084789.000000 2024-11-15,1010,8.030000,8.030000,8.020000,8.030000,720300.000000,5781314.000000 2024-11-15,1011,8.030000,8.030000,8.020000,8.020000,404700.000000,3248429.000000 2024-11-15,1012,8.030000,8.030000,8.020000,8.020000,683600.000000,5484744.000000 2024-11-15,1013,8.020000,8.030000,8.020000,8.020000,1121200.000000,8993758.000000 2024-11-15,1014,8.020000,8.030000,8.020000,8.020000,607000.000000,4868843.000000 2024-11-15,1015,8.020000,8.040000,8.020000,8.040000,1399600.000000,11235654.000000 2024-11-15,1016,8.040000,8.040000,8.030000,8.030000,511100.000000,4107410.000000 2024-11-15,1017,8.030000,8.040000,8.020000,8.040000,311600.000000,2502496.000000 2024-11-15,1018,8.030000,8.040000,8.030000,8.040000,423300.000000,3402240.000000 2024-11-15,1019,8.040000,8.040000,8.030000,8.030000,168300.000000,1351822.000000 2024-11-15,1020,8.030000,8.040000,8.030000,8.030000,195200.000000,1567751.000000 2024-11-15,1021,8.040000,8.040000,8.030000,8.030000,796500.000000,6396644.000000 2024-11-15,1022,8.030000,8.030000,8.020000,8.030000,394700.000000,3166347.000000 2024-11-15,1023,8.020000,8.020000,8.020000,8.020000,323400.000000,2593847.000000 2024-11-15,1024,8.020000,8.030000,8.020000,8.030000,314600.000000,2524649.000000 2024-11-15,1025,8.030000,8.040000,8.020000,8.040000,716200.000000,5751046.000000 2024-11-15,1026,8.030000,8.040000,8.030000,8.030000,304100.000000,2442663.000000 2024-11-15,1027,8.030000,8.050000,8.030000,8.040000,1008100.000000,8105719.000000 2024-11-15,1028,8.050000,8.050000,8.040000,8.040000,231000.000000,1858060.000000 2024-11-15,1029,8.040000,8.040000,8.030000,8.040000,650600.000000,5230323.000000 2024-11-15,1030,8.030000,8.040000,8.030000,8.040000,352800.000000,2833699.000000 2024-11-15,1031,8.030000,8.040000,8.030000,8.040000,1030100.000000,8278005.000000 2024-11-15,1032,8.040000,8.040000,8.030000,8.040000,149200.000000,1198459.000000 2024-11-15,1033,8.030000,8.040000,8.030000,8.030000,283800.000000,2279759.000000 2024-11-15,1034,8.040000,8.040000,8.030000,8.040000,1124700.000000,9041284.000000 2024-11-15,1035,8.040000,8.050000,8.040000,8.040000,189500.000000,1524454.000000 2024-11-15,1036,8.040000,8.040000,8.030000,8.030000,401900.000000,3230280.000000 2024-11-15,1037,8.040000,8.040000,8.030000,8.030000,188200.000000,1512420.000000 2024-11-15,1038,8.030000,8.040000,8.020000,8.020000,1630500.000000,13086496.000000 2024-11-15,1039,8.020000,8.030000,8.020000,8.020000,449200.000000,3603702.000000 2024-11-15,1040,8.020000,8.030000,8.020000,8.020000,658800.000000,5283846.000000 2024-11-15,1041,8.020000,8.030000,8.010000,8.020000,790500.000000,6335033.000000 2024-11-15,1042,8.010000,8.020000,8.010000,8.010000,707500.000000,5667960.000000 2024-11-15,1043,8.010000,8.020000,8.010000,8.010000,865600.000000,6933622.000000 2024-11-15,1044,8.020000,8.020000,8.010000,8.010000,799300.000000,6403793.000000 2024-11-15,1045,8.020000,8.020000,8.010000,8.020000,1362200.000000,10913293.000000 2024-11-15,1046,8.010000,8.020000,8.010000,8.020000,518200.000000,4154975.000000 2024-11-15,1047,8.020000,8.030000,8.010000,8.020000,482500.000000,3871999.000000 2024-11-15,1048,8.020000,8.030000,8.020000,8.020000,186900.000000,1499790.000000 2024-11-15,1049,8.020000,8.030000,8.020000,8.020000,333400.000000,2674145.000000 2024-11-15,1050,8.020000,8.040000,8.020000,8.020000,540800.000000,4342374.000000 2024-11-15,1051,8.020000,8.040000,8.020000,8.040000,174200.000000,1398909.000000 2024-11-15,1052,8.040000,8.040000,8.030000,8.030000,256300.000000,2058344.000000 2024-11-15,1053,8.040000,8.040000,8.030000,8.030000,182000.000000,1462231.000000 2024-11-15,1054,8.030000,8.040000,8.020000,8.020000,241100.000000,1936487.000000 2024-11-15,1055,8.030000,8.040000,8.020000,8.030000,193200.000000,1551720.000000 2024-11-15,1056,8.030000,8.050000,8.030000,8.050000,2146900.000000,17270578.000000 2024-11-15,1057,8.050000,8.050000,8.040000,8.040000,335700.000000,2699458.000000 2024-11-15,1058,8.040000,8.050000,8.030000,8.030000,419200.000000,3369680.000000 2024-11-15,1059,8.040000,8.040000,8.030000,8.040000,144400.000000,1160327.000000 2024-11-15,1100,8.030000,8.050000,8.030000,8.040000,132100.000000,1062094.000000 2024-11-15,1101,8.040000,8.040000,8.030000,8.040000,177100.000000,1423440.000000 2024-11-15,1102,8.030000,8.040000,8.030000,8.040000,140000.000000,1124337.000000 2024-11-15,1103,8.030000,8.030000,8.020000,8.030000,828100.000000,6648455.000000 2024-11-15,1104,8.020000,8.030000,8.020000,8.020000,94300.000000,756392.000000 2024-11-15,1105,8.030000,8.030000,8.020000,8.020000,215000.000000,1725319.000000 2024-11-15,1106,8.020000,8.030000,8.020000,8.020000,157000.000000,1259373.000000 2024-11-15,1107,8.020000,8.040000,8.020000,8.030000,401700.000000,3225771.000000 2024-11-15,1108,8.030000,8.030000,8.020000,8.020000,509500.000000,4090324.000000 2024-11-15,1109,8.030000,8.040000,8.020000,8.030000,146200.000000,1173834.000000 2024-11-15,1110,8.030000,8.040000,8.020000,8.020000,173000.000000,1389206.000000 2024-11-15,1111,8.020000,8.030000,8.020000,8.030000,164200.000000,1317426.000000 2024-11-15,1112,8.020000,8.030000,8.020000,8.030000,167400.000000,1343575.000000 2024-11-15,1113,8.020000,8.030000,8.020000,8.020000,379200.000000,3043623.000000 2024-11-15,1114,8.020000,8.030000,8.020000,8.030000,194900.000000,1564085.000000 2024-11-15,1115,8.030000,8.030000,8.020000,8.030000,219300.000000,1759554.000000 2024-11-15,1116,8.030000,8.030000,8.020000,8.020000,880800.000000,7070141.000000 2024-11-15,1117,8.030000,8.030000,8.020000,8.020000,457200.000000,3669601.000000 2024-11-15,1118,8.020000,8.020000,8.010000,8.020000,479200.000000,3842318.000000 2024-11-15,1119,8.020000,8.030000,8.010000,8.010000,295500.000000,2369194.000000 2024-11-15,1120,8.010000,8.020000,8.010000,8.020000,155200.000000,1244270.000000 2024-11-15,1121,8.010000,8.020000,8.010000,8.020000,157300.000000,1260370.000000 2024-11-15,1122,8.010000,8.020000,8.010000,8.010000,1362800.000000,10917121.000000 2024-11-15,1123,8.000000,8.010000,8.000000,8.010000,620300.000000,4966209.000000 2024-11-15,1124,8.010000,8.010000,8.000000,8.000000,316900.000000,2536844.000000 2024-11-15,1125,8.010000,8.010000,8.000000,8.010000,750400.000000,6008255.000000 2024-11-15,1126,8.010000,8.010000,8.000000,8.010000,241000.000000,1929306.000000 2024-11-15,1127,8.010000,8.010000,8.000000,8.010000,488900.000000,3914637.000000 2024-11-15,1128,8.000000,8.020000,8.000000,8.010000,378400.000000,3030132.000000 2024-11-15,1129,8.010000,8.020000,8.010000,8.020000,164000.000000,1314377.000000 2024-11-15,1130,8.010000,8.010000,8.010000,8.010000,406400.000000,3255838.000000 2024-11-15,1301,8.010000,8.020000,7.990000,7.990000,4325300.000000,34610020.000000 2024-11-15,1302,7.990000,7.990000,7.980000,7.980000,3075900.000000,24574056.000000 2024-11-15,1303,7.980000,8.000000,7.980000,7.990000,246700.000000,1971900.000000 2024-11-15,1304,7.990000,8.000000,7.990000,8.000000,433000.000000,3463319.000000 2024-11-15,1305,8.000000,8.000000,7.990000,8.000000,290000.000000,2318982.000000 2024-11-15,1306,8.000000,8.000000,7.990000,8.000000,392800.000000,3142274.000000 2024-11-15,1307,8.000000,8.010000,7.990000,8.000000,355900.000000,2847359.000000 2024-11-15,1308,8.000000,8.000000,7.990000,7.990000,111000.000000,887626.000000 2024-11-15,1309,8.000000,8.010000,7.990000,7.990000,685500.000000,5483925.000000 2024-11-15,1310,7.990000,8.010000,7.990000,8.010000,490000.000000,3920540.000000 2024-11-15,1311,8.010000,8.010000,8.000000,8.000000,108800.000000,871061.000000 2024-11-15,1312,8.010000,8.010000,8.000000,8.000000,151700.000000,1214024.000000 2024-11-15,1313,8.000000,8.010000,8.000000,8.010000,157100.000000,1257867.000000 2024-11-15,1314,8.000000,8.000000,7.990000,8.000000,899100.000000,7192301.000000 2024-11-15,1315,7.990000,8.010000,7.990000,8.000000,559600.000000,4475420.000000 2024-11-15,1316,8.000000,8.000000,7.990000,8.000000,416600.000000,3330700.000000 2024-11-15,1317,7.990000,8.010000,7.990000,8.000000,299100.000000,2391893.000000 2024-11-15,1318,8.000000,8.010000,8.000000,8.000000,172500.000000,1380300.000000 2024-11-15,1319,8.000000,8.010000,8.000000,8.000000,178000.000000,1424563.000000 2024-11-15,1320,8.010000,8.010000,8.000000,8.000000,201600.000000,1614011.000000 2024-11-15,1321,8.010000,8.020000,8.000000,8.020000,1023000.000000,8194524.000000 2024-11-15,1322,8.020000,8.020000,8.010000,8.010000,235600.000000,1887547.000000 2024-11-15,1323,8.010000,8.020000,8.010000,8.010000,98000.000000,785427.000000 2024-11-15,1324,8.010000,8.020000,8.010000,8.020000,668400.000000,5359657.000000 2024-11-15,1325,8.020000,8.020000,8.010000,8.010000,207900.000000,1666253.000000 2024-11-15,1326,8.020000,8.030000,8.010000,8.030000,318200.000000,2552220.000000 2024-11-15,1327,8.030000,8.030000,8.020000,8.030000,171900.000000,1379947.000000 2024-11-15,1328,8.030000,8.030000,8.020000,8.020000,695800.000000,5580790.000000 2024-11-15,1329,8.020000,8.030000,8.020000,8.020000,734100.000000,5888629.000000 2024-11-15,1330,8.020000,8.030000,8.020000,8.020000,271600.000000,2179919.000000 2024-11-15,1331,8.030000,8.040000,8.030000,8.040000,1438300.000000,11549654.000000 2024-11-15,1332,8.030000,8.040000,8.030000,8.040000,715400.000000,5751204.000000 2024-11-15,1333,8.040000,8.050000,8.040000,8.050000,1227500.000000,9871893.000000 2024-11-15,1334,8.050000,8.050000,8.040000,8.040000,418600.000000,3366878.000000 2024-11-15,1335,8.040000,8.060000,8.040000,8.060000,2761500.000000,22223204.000000 2024-11-15,1336,8.050000,8.070000,8.050000,8.060000,2301600.000000,18551158.000000 2024-11-15,1337,8.060000,8.060000,8.050000,8.050000,393100.000000,3165452.000000 2024-11-15,1338,8.060000,8.070000,8.050000,8.070000,1758400.000000,14169462.000000 2024-11-15,1339,8.060000,8.070000,8.060000,8.060000,656600.000000,5294691.000000 2024-11-15,1340,8.070000,8.080000,8.060000,8.070000,2872700.000000,23187060.000000 2024-11-15,1341,8.070000,8.080000,8.060000,8.080000,1291100.000000,10422378.000000 2024-11-15,1342,8.070000,8.080000,8.070000,8.070000,1189100.000000,9603701.000000 2024-11-15,1343,8.070000,8.080000,8.060000,8.060000,749200.000000,6047611.000000 2024-11-15,1344,8.070000,8.080000,8.060000,8.070000,861800.000000,6954263.000000 2024-11-15,1345,8.070000,8.080000,8.060000,8.060000,818300.000000,6605058.000000 2024-11-15,1346,8.060000,8.070000,8.060000,8.070000,356900.000000,2878477.000000 2024-11-15,1347,8.060000,8.070000,8.050000,8.060000,997800.000000,8042588.000000 2024-11-15,1348,8.060000,8.070000,8.060000,8.060000,531700.000000,4287492.000000 2024-11-15,1349,8.060000,8.070000,8.060000,8.070000,1478100.000000,11927237.000000 2024-11-15,1350,8.070000,8.080000,8.070000,8.070000,498000.000000,4019251.000000 2024-11-15,1351,8.070000,8.090000,8.070000,8.090000,2867900.000000,23170968.000000 2024-11-15,1352,8.090000,8.100000,8.080000,8.090000,3150400.000000,25487090.000000 2024-11-15,1353,8.090000,8.100000,8.080000,8.090000,1535500.000000,12430082.000000 2024-11-15,1354,8.090000,8.090000,8.080000,8.090000,546000.000000,4415757.000000 2024-11-15,1355,8.080000,8.090000,8.080000,8.090000,1161000.000000,9391873.000000 2024-11-15,1356,8.080000,8.090000,8.080000,8.080000,207800.000000,1680040.000000 2024-11-15,1357,8.080000,8.090000,8.080000,8.080000,408900.000000,3305209.000000 2024-11-15,1358,8.090000,8.090000,8.080000,8.090000,1512100.000000,12231471.000000 2024-11-15,1359,8.080000,8.090000,8.080000,8.080000,297600.000000,2406357.000000 2024-11-15,1400,8.090000,8.090000,8.080000,8.090000,695800.000000,5628477.000000 2024-11-15,1401,8.080000,8.080000,8.070000,8.070000,608400.000000,4915583.000000 2024-11-15,1402,8.070000,8.080000,8.070000,8.070000,466800.000000,3767966.000000 2024-11-15,1403,8.070000,8.080000,8.060000,8.070000,574800.000000,4637873.000000 2024-11-15,1404,8.070000,8.080000,8.070000,8.080000,169200.000000,1366404.000000 2024-11-15,1405,8.070000,8.080000,8.070000,8.070000,218600.000000,1764586.000000 2024-11-15,1406,8.070000,8.080000,8.070000,8.070000,244000.000000,1969893.000000 2024-11-15,1407,8.070000,8.080000,8.060000,8.070000,456000.000000,3680285.000000 2024-11-15,1408,8.070000,8.080000,8.070000,8.070000,276700.000000,2234168.000000 2024-11-15,1409,8.070000,8.080000,8.070000,8.070000,818000.000000,6607832.000000 2024-11-15,1410,8.070000,8.080000,8.070000,8.070000,838400.000000,6766784.000000 2024-11-15,1411,8.070000,8.080000,8.060000,8.070000,736400.000000,5944560.000000 2024-11-15,1412,8.060000,8.070000,8.060000,8.070000,486000.000000,3921048.000000 2024-11-15,1413,8.060000,8.070000,8.060000,8.070000,464700.000000,3748746.000000 2024-11-15,1414,8.060000,8.070000,8.060000,8.060000,482900.000000,3894697.000000 2024-11-15,1415,8.060000,8.070000,8.060000,8.060000,433100.000000,3494315.000000 2024-11-15,1416,8.060000,8.070000,8.060000,8.060000,1035600.000000,8356448.000000 2024-11-15,1417,8.060000,8.070000,8.060000,8.070000,421400.000000,3400316.000000 2024-11-15,1418,8.070000,8.080000,8.070000,8.080000,576600.000000,4655769.000000 2024-11-15,1419,8.070000,8.080000,8.070000,8.070000,527800.000000,4259765.000000 2024-11-15,1420,8.070000,8.080000,8.060000,8.070000,396600.000000,3201869.000000 2024-11-15,1421,8.070000,8.080000,8.070000,8.070000,390600.000000,3153279.000000 2024-11-15,1422,8.070000,8.070000,8.060000,8.070000,421400.000000,3400159.000000 2024-11-15,1423,8.060000,8.070000,8.060000,8.070000,677100.000000,5464251.000000 2024-11-15,1424,8.070000,8.080000,8.070000,8.070000,433900.000000,3502116.000000 2024-11-15,1425,8.070000,8.070000,8.060000,8.060000,398900.000000,3218989.000000 2024-11-15,1426,8.060000,8.070000,8.060000,8.070000,804600.000000,6492501.000000 2024-11-15,1427,8.070000,8.080000,8.070000,8.070000,688400.000000,5558874.000000 2024-11-15,1428,8.070000,8.070000,8.060000,8.070000,604700.000000,4881314.000000 2024-11-15,1429,8.060000,8.080000,8.060000,8.070000,350300.000000,2827623.000000 2024-11-15,1430,8.070000,8.070000,8.060000,8.070000,394500.000000,3183022.000000 2024-11-15,1431,8.060000,8.070000,8.060000,8.060000,377200.000000,3043120.000000 2024-11-15,1432,8.070000,8.070000,8.060000,8.060000,949700.000000,7661354.000000 2024-11-15,1433,8.070000,8.070000,8.050000,8.070000,813800.000000,6559578.000000 2024-11-15,1434,8.060000,8.070000,8.050000,8.060000,618700.000000,4984694.000000 2024-11-15,1435,8.050000,8.070000,8.050000,8.060000,719500.000000,5801158.000000 2024-11-15,1436,8.070000,8.070000,8.060000,8.070000,1244200.000000,10039249.000000 2024-11-15,1437,8.070000,8.080000,8.060000,8.070000,448500.000000,3620993.000000 2024-11-15,1438,8.070000,8.070000,8.060000,8.070000,407000.000000,3283407.000000 2024-11-15,1439,8.060000,8.070000,8.050000,8.060000,995700.000000,8026607.000000 2024-11-15,1440,8.060000,8.070000,8.060000,8.060000,227600.000000,1835825.000000 2024-11-15,1441,8.060000,8.070000,8.050000,8.050000,326400.000000,2630630.000000 2024-11-15,1442,8.060000,8.060000,8.050000,8.060000,533400.000000,4298855.000000 2024-11-15,1443,8.060000,8.060000,8.050000,8.060000,344800.000000,2778402.000000 2024-11-15,1444,8.060000,8.070000,8.050000,8.060000,603500.000000,4864374.000000 2024-11-15,1445,8.060000,8.060000,8.050000,8.060000,302900.000000,2440150.000000 2024-11-15,1446,8.050000,8.060000,8.050000,8.050000,235700.000000,1898692.000000 2024-11-15,1447,8.060000,8.060000,8.050000,8.060000,374100.000000,3012876.000000 2024-11-15,1448,8.050000,8.060000,8.050000,8.050000,1758600.000000,14159701.000000 2024-11-15,1449,8.050000,8.050000,8.040000,8.050000,657300.000000,5285793.000000 2024-11-15,1450,8.050000,8.050000,8.040000,8.050000,526800.000000,4236858.000000 2024-11-15,1451,8.040000,8.050000,8.040000,8.050000,832800.000000,6697294.000000 2024-11-15,1452,8.050000,8.050000,8.030000,8.040000,1514000.000000,12169166.000000 2024-11-15,1453,8.040000,8.040000,8.030000,8.030000,486900.000000,3911587.000000 2024-11-15,1454,8.040000,8.040000,8.030000,8.030000,652100.000000,5238021.000000 2024-11-15,1455,8.030000,8.040000,8.030000,8.030000,2333400.000000,18740656.000000 2024-11-15,1456,8.020000,8.030000,8.020000,8.030000,1425900.000000,11446936.000000 2024-11-15,1457,8.030000,8.040000,8.020000,8.040000,1383200.000000,11110531.000000 2024-11-15,1458,8.040000,8.040000,8.040000,8.040000,0.000000,0.000000 2024-11-15,1459,8.040000,8.040000,8.040000,8.040000,0.000000,0.000000 2024-11-15,1500,8.030000,8.030000,8.030000,8.030000,1853600.000000,14884071.000000".to_string();
		}
		let str_split:Vec<&str> = data.split(" ").collect();
		for i in 0..str_split.len(){
			let sub_str = str_split[i];
			let sub_str_split:Vec<&str> = sub_str.split(",").collect();
			if sub_str_split.len() > 5{
				let mut s_data1:SecurityData = SecurityData::new();
				s_data1.volume = sub_str_split[6].to_string().parse::<f64>().unwrap() / 100.0;
				s_data1.close = sub_str_split[5].to_string().parse::<f64>().unwrap();
				s_data1.high = sub_str_split[3].to_string().parse::<f64>().unwrap();
				s_data1.low = sub_str_split[4].to_string().parse::<f64>().unwrap();
				s_data1.open = sub_str_split[2].to_string().parse::<f64>().unwrap();
				s_data1.date = i as f64;
				security_datas.push(s_data1);
			}
		}
	}
	
	let mut split_view:FCView = FCView::new();
	split_view.location = FCPoint{x:0.0, y:0.0};
	split_view.size = FCSize{cx:400.0, cy:400.0};
	split_view.back_color = "rgb(0,0,0)".to_string();
	split_view.border_color = "rgb(100,100,100)".to_string();
	split_view.view_type = "split".to_string();
	split_view.dock = "fill".to_string();
	split_view.view_id = add_view_to_parent(split_view.clone(), my_chart.clone());
	
	let mut first_view:FCView = FCView::new();
	first_view.back_color = "none".to_string();
	first_view.view_id = add_view_to_parent(first_view.clone(), split_view.clone());
		
	let mut second_view:FCView = FCView::new();
	second_view.back_color = "none".to_string();
	second_view.view_id = add_view_to_parent(second_view.clone(), split_view.clone());
		
	let mut splitter:FCView = FCView::new();
	splitter.back_color = "rgb(150,150,150)".to_string();
	splitter.location = FCPoint{x:0.0, y:25.0};
	splitter.size = FCSize{cx:400.0, cy:1.0};
	splitter.view_id = add_view_to_parent(splitter.clone(), split_view.clone());
		
	let mut split:FCSplitLayoutDiv = FCSplitLayoutDiv::new();
	split.first_view = first_view.clone();
	split.second_view = second_view.clone();
	split.layout_style = "toptobottom".to_string();
	split.splitter = splitter.clone();
	split.old_size = FCSize{cx:400.0, cy:400.0};
	split.view = split_view.clone();
	reset_split_layout_div(&mut split);
	M_SPLIT_MAP.lock().unwrap().insert(split_view.view_id, split.clone());

	let mut layout_view:FCView = FCView::new();
	layout_view.location = FCPoint{x:0.0, y:0.0};
	layout_view.size = FCSize{cx:400.0, cy:25.0};
	layout_view.back_color = "rgb(0,0,0)".to_string();
	layout_view.border_color = "rgb(100,100,100)".to_string();
	layout_view.view_type = "layout".to_string();
	layout_view.allow_drag_scroll = true;
	layout_view.view_id = add_view_to_parent(layout_view.clone(), first_view.clone());
	let mut cycles : Vec<String> = Vec::new();
    cycles.push("1".to_string());
    cycles.push("5".to_string());
    cycles.push("10".to_string());
    cycles.push("15".to_string());
    cycles.push("20".to_string());
    cycles.push("30".to_string());
    cycles.push("60".to_string());
    cycles.push("90".to_string());
    cycles.push("120".to_string());
    cycles.push("日".to_string());
    cycles.push("周".to_string());
    cycles.push("月".to_string());
	cycles.push("季".to_string());
	cycles.push("半".to_string());
	cycles.push("年".to_string());
	for i in 0..cycles.len(){
		let mut sub_view2:FCView = FCView::new();
		sub_view2.size = FCSize{cx:27.0, cy:25.0};
		sub_view2.back_color = "rgb(0,0,0)".to_string();
		sub_view2.border_color = "rgb(100,100,100)".to_string();
		sub_view2.text_color = "rgb(190,190,235)".to_string();
		sub_view2.text = cycles[i].to_string();
		add_view_to_parent(sub_view2.clone(), layout_view.clone());
	}

	let mut layout_div:FCLayoutDiv = FCLayoutDiv::new();
		
	layout_div.view = layout_view.clone();
	layout_div.layout_style = "lefttoright".to_string();
	reset_layout_div(&mut layout_div);
	M_LAYOUT_MAP.lock().unwrap().insert(layout_view.view_id, layout_div.clone());

	let mut chart_view:FCView = FCView::new();
	chart_view.location = FCPoint{x:0.0, y:0.0};
	chart_view.size = FCSize{cx:400.0, cy:400.0};
	chart_view.back_color = "rgb(0,0,0)".to_string();
	chart_view.border_color = "none".to_string();
	chart_view.text_color = "rgb(190,190,235)".to_string();
	chart_view.view_type = "chart".to_string();
	chart_view.dock = "fill".to_string();
	let mut title =  "601857.SH 中国石油 ".to_string();
	if cycle == 0{
		title = title + "分时";
	}else if cycle < 1440{
		title = title + &to_fixed(cycle as f64, 0) + "分钟";
	}else if cycle == 1440{
		title = title + "日线";
	}else if cycle == 10080{
		title = title + "周线";
	}else if cycle == 43200{
		title = title + "月线";
	}
	chart_view.text = title;
	chart_view.view_id = add_view_to_parent(chart_view.clone(), second_view.clone());
	let mut chart:FCChart = FCChart::new();
	chart.view = chart_view.clone();
	chart.datas = security_datas;
	chart.scale_color = "rgb(75,75,75)".to_string();
	chart.cross_tip_color = "rgb(50,50,50)".to_string();
	chart.cross_line_color = "rgb(100,100,100)".to_string();
	chart.grid_color = "rgb(50,50,50)".to_string();
	chart.left_vscale_width = 0.0;
	chart.right_vscale_width = 60.0;
	chart.candle_div_percent = 0.7;
	chart.vol_div_percent = 0.3;
	chart.ind_div_percent = 0.0;
	chart.candle_style = "rect2".to_string();
	chart.bar_style = "rect2".to_string();
	chart.hscale_text_color = "rgb(194,151,18)".to_string();
	chart.vscale_text_color = "rgb(194,151,18)".to_string();
	chart.trend_color = "rgb(255,255,255)".to_string();
	chart.hscale_text_distance = 40.0;
	chart.allow_drag_chart_div = true;
	if cycle == 0{
		chart.cycle = "trend".to_string();
		chart.auto_fill_hscale = true;
	}
	if cycle > 0{
		chart.up_color = "rgb(186,56,18)".to_string();
		chart.down_color = "rgb(31,182,177)".to_string();
	}
	reset_chart_visible_record(&mut chart);
	calc_chart_indicator(&mut chart);
	M_CHART_MAP.lock().unwrap().insert(chart_view.view_id, chart.clone());
}

/*
* Start rust
*/
#[wasm_bindgen(start)]
pub fn start() -> Result<(), JsValue> {
    let window = web_sys::window().expect("should have a window in this context");
    let document = window.document().expect("window should have a document");
    let canvas = document
        .create_element("canvas")?
        .dyn_into::<web_sys::HtmlCanvasElement>()?;
    let device_pixel_ratio = window.device_pixel_ratio();
    document.body().unwrap().append_child(&canvas)?;
    canvas.style().set_property("position", "fixed")?;
    canvas.style().set_property("left", "0px")?;
    canvas.style().set_property("top", "0px")?;
	unsafe{
        M_CANVAS_WIDTH = window.inner_width().unwrap().as_f64().unwrap() as f32;
        M_CANVAS_HEIGHT = window.inner_height().unwrap().as_f64().unwrap() as f32;
        if M_CANVAS_WIDTH < M_CANVAS_HEIGHT {
            M_IS_MOBILE = true;
            M_PAINT.lock().unwrap().scale_factor_x = 2.5;
            M_PAINT.lock().unwrap().scale_factor_y = 2.5;
        }
		canvas.set_width((M_CANVAS_WIDTH * device_pixel_ratio as f32) as u32);
		canvas.set_height((M_CANVAS_HEIGHT * device_pixel_ratio as f32) as u32);
		canvas.style().set_property(&("width".to_string()), &(M_CANVAS_WIDTH.to_string() + "px")).unwrap();
		canvas.style().set_property(&("height".to_string()), &(M_CANVAS_HEIGHT.to_string() + "px")).unwrap();
	}
    let context = canvas
        .get_context("2d")?
        .unwrap()
        .dyn_into::<web_sys::CanvasRenderingContext2d>()?;
	context.scale(device_pixel_ratio, device_pixel_ratio).unwrap();
    let context = Rc::new(context);
    let pressed = Rc::new(Cell::new(false));

    { mouse_down(&context, &pressed, &canvas); }
    { mouse_move(&context, &pressed, &canvas); }
    { mouse_up(&context, &pressed, &canvas); }
    { mouse_wheel(&context, &pressed, &canvas); }
    { touch_start(&context, &pressed, &canvas); }
    { touch_move(&context, &pressed, &canvas); }
    { touch_end(&context, &pressed, &canvas); }
    let xml = r#"<?xml version="1.0" encoding="utf-8" ?>
        <html xmlns="facecat">
        <body>
            <div bordercolor="none" name="divInner" dock="fill">
                <div type="tab" dock="fill" selectedindex="0" backcolor="none" bordercolor="none" name="tabFunc">
                    <div type="tabpage" text="主界面" name="divMain" backcolor="none">
                    <div type="splitlayout" layoutstyle="lefttoright" bordercolor="none" dock="fill"
                            size="710,710" candragsplitter="true" splitterposition="710,1" name="divCodingRight2">
                            <table name="gridStocks" headerheight="30" dock="fill"
                                gridlinecolor="none" bordercolor="none" showvscrollbar="true" showhscrollbar="true"
                                allowpreviewsevent="true" allowdragscroll="true">
                                <tr>
                                    <th name="colP0" text="序" width="40" allowdrag="true" allowresize="true"/>
                                    <th name="colP1" text="代码" width="70" allowdrag="true" allowresize="true"/>
                                    <th name="colP2" text="名称" width="70" allowdrag="true" allowresize="true" />
                                    <th name="colP3" text="现价" width="60" allowdrag="true" allowresize="true" cellalign="right"/>
                                    <th name="colP4" text="涨幅" width="60" allowdrag="true" allowresize="true" cellalign="right"/>
                                    <th name="colP5" text="涨跌" width="60" allowdrag="true" allowresize="true" cellalign="right"/>
                                    <th name="colP9" text="总量" width="60" allowdrag="true" allowresize="true" cellalign="right"/>
                                    <th name="colP10" text="总额" width="60" allowdrag="true" allowresize="true" cellalign="right"/>
                                    <th name="colP11" text="量比" width="60" allowdrag="true" allowresize="true" cellalign="right"/>
                                    <th name="colP12" text="PE动" width="60" allowdrag="true" allowresize="true" cellalign="right"/>
                                    <th name="colP13" text="振幅" width="60" allowdrag="true" allowresize="true" cellalign="right"/>
                                    <th name="colP14" text="换手率" width="60" allowdrag="true" allowresize="true" cellalign="right"/>
                                    <th name="colP15" text="总市值" width="60" allowdrag="true" allowresize="true" cellalign="right"/>
                                    <th name="colP16" text="流值" width="60" allowdrag="true" allowresize="true" cellalign="right"/>
                                    <th name="colP17" text="行业分类板块" width="80" allowdrag="true" allowresize="true" cellalign="center"/>
                                    <th name="colP18" text="涨停价" width="60" allowdrag="true" allowresize="true" cellalign="right"/>
                                    <th name="colP19" text="跌停价" width="60" allowdrag="true" allowresize="true" cellalign="right"/>
                                    <th name="colP20" text="金比" width="60" allowdrag="true" allowresize="true" cellalign="right"/>
                                    <th name="colP21" text="涨跌比" width="60" allowdrag="true" allowresize="true" cellalign="right"/>
                                    <th name="colP22" text="涨速" width="60" allowdrag="true" allowresize="true" cellalign="right"/>
                                    <th name="colP23" text="净资产收益率" width="100" allowdrag="true" allowresize="true" cellalign="right"/>
                                    <th name="colP24" text="自设指标" width="80" allowdrag="true" allowresize="true" cellalign="right"/>
                                </tr>
                            </table>
                            <div type="splitlayout" layoutstyle="toptobottom" bordercolor="none" dock="fill"
                                size="400,400" candragsplitter="true" splitterposition="380,1">
                               <div type="custom" cid="mychart" name="mainChart1" cycle="0" candledivpercent="0.7"
                                            voldivpercent="0.3" backcolor="none" bordercolor="none"/>
                                <div type="splitlayout" layoutstyle="lefttoright" bordercolor="none" dock="fill"
                                    size="400,400" candragsplitter="true" splitmode="percentsize" splitterposition="200,1">
                                    <div type="custom" cid="mychart" name="mainChart2" cycle="5" candledivpercent="0.7"
                                            voldivpercent="0.3" backcolor="none" bordercolor="none"/>
                                    <div type="custom" cid="mychart" name="mainChart3" cycle="1440" candledivpercent="0.7"
                                            voldivpercent="0.3" backcolor="none" bordercolor="none"/>
                                </div>
                            </div>
                        </div>
                        </div>
                        <div type="tabpage" text="多K线" name="divMulti" backcolor="none">
                            <div type="splitlayout" layoutstyle="lefttoright" backcolor="none" bordercolor="none"
                                dock="fill" size="400,400" candragsplitter="true" splitmode="percentsize" splitterposition="133,1">
                                <div type="splitlayout" layoutstyle="toptobottom" backcolor="none" bordercolor="none"
                                    dock="fill" size="400,400" candragsplitter="true" splitmode="percentsize" splitterposition="267,1">
                                    <div type="splitlayout" layoutstyle="toptobottom" backcolor="none" bordercolor="none"
                                        dock="fill" size="400,400" candragsplitter="true" splitmode="percentsize" splitterposition="200,1">
                                        <div type="custom" cid="mychart" name="chart1" cycle="1" nativerefresh="true" candledivpercent="1"
                                            voldivpercent="0" backcolor="none" bordercolor="none"/>
                                        <div type="custom" cid="mychart" name="chart2" cycle="5" nativerefresh="true" candledivpercent="1"
                                            voldivpercent="0" backcolor="none" bordercolor="none"/>
                                    </div>
                                    <div type="custom" cid="mychart" name="chart3" cycle="10" nativerefresh="true" candledivpercent="1"
                                        voldivpercent="0" backcolor="none" bordercolor="none"/>
                                </div>
                                <div type="splitlayout" layoutstyle="lefttoright" backcolor="none" bordercolor="none"
                                    dock="fill" size="400,400" candragsplitter="true" splitmode="percentsize" splitterposition="200,1">
                                    <div type="splitlayout" layoutstyle="toptobottom" backcolor="none" bordercolor="none"
                                        dock="fill" size="400,400" candragsplitter="true" splitmode="percentsize" splitterposition="267,1">
                                        <div type="splitlayout" layoutstyle="toptobottom" backcolor="none" bordercolor="none"
                                            dock="fill" size="400,400" candragsplitter="true" splitmode="percentsize" splitterposition="200,1">
                                            <div type="custom" cid="mychart" name="chart4" cycle="15" nativerefresh="true" candledivpercent="1"
                                                voldivpercent="0" backcolor="none" bordercolor="none"/>
                                            <div type="custom" cid="mychart" name="chart5" cycle="20" nativerefresh="true" candledivpercent="1"
                                                voldivpercent="0" backcolor="none" bordercolor="none"/>
                                        </div>
                                        <div type="custom" cid="mychart" name="chart6" cycle="30" nativerefresh="true" candledivpercent="1"
                                            voldivpercent="0" backcolor="none" bordercolor="none"/>
                                    </div>
                                    <div type="splitlayout" layoutstyle="toptobottom" backcolor="none" bordercolor="none"
                                        dock="fill" size="400,400" candragsplitter="true" splitmode="percentsize" splitterposition="267,1">
                                        <div type="splitlayout" layoutstyle="toptobottom" backcolor="none" bordercolor="none"
                                            dock="fill" size="400,400" candragsplitter="true" splitmode="percentsize" splitterposition="200,1">
                                            <div type="custom" cid="mychart" name="chart7" cycle="1440" nativerefresh="true"
                                                candledivpercent="1" voldivpercent="0" backcolor="none" bordercolor="none"/>
                                            <div type="custom" cid="mychart" name="chart8" cycle="10080" nativerefresh="true"
                                                candledivpercent="1" voldivpercent="0" backcolor="none" bordercolor="none"/>
                                        </div>
                                        <div type="custom" cid="mychart" name="chart9" cycle="43200" nativerefresh="true"
                                            candledivpercent="1" voldivpercent="0" backcolor="none" bordercolor="none"/>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
        </body>
        </html>"#;
	render_facecat(xml.to_string());
	let top_views = get_top_views();
	let g_view = find_view_by_name("gridStocks".to_string(), top_views.clone());
	for (_vid, v) in M_GRID_MAP.lock().unwrap().iter_mut(){
		if g_view.view_id == *_vid{
			let mut gridStocks = v;
			for i in 0..gridStocks.columns.len(){
				gridStocks.columns[i].back_color = "rgb(50,50,50)".to_string();
				if i == 0{
					gridStocks.columns[i].width = 40.0;
				}else{
					gridStocks.columns[i].width = 70.0;
				}
			}
			gridStocks.selected_row_color = r"rgb(75,75,75)".to_string();
			gridStocks.alternate_row_color = r"rgb(25,25,25)".to_string();
			let data = "300910.SZ,瑞丰新材,45.270000,45.950000,44.820000,45.080000,2912800.000000,132092514.000000,45.380000,291789935.000000,9261000000.000000,19.810000,0.980000,1.420000,54.460000,36.300000,2024-11-15 15:00:00 300911.SZ,亿田智能,26.290000,26.980000,26.020000,26.390000,2171700.000000,57395815.000000,26.490000,138462420.000000,3398000000.000000,-247.390000,0.430000,1.680000,31.790000,21.190000,2024-11-15 15:00:00 300912.SZ,凯龙高科,13.540000,13.730000,13.230000,13.500000,8100800.000000,109525474.000000,13.400000,114982000.000000,1162000000.000000,-10.050000,0.800000,9.440000,16.080000,10.720000,2024-11-15 15:00:00 300913.SZ,兆龙互连,34.370000,36.400000,34.350000,35.370000,6256800.000000,221789763.000000,35.960000,259561736.000000,7295000000.000000,74.470000,0.790000,2.950000,43.150000,28.770000,2024-11-15 15:00:00 300915.SZ,海融科技,33.000000,34.090000,32.980000,33.490000,1032500.000000,34732034.000000,33.510000,90000000.000000,1353000000.000000,25.460000,0.420000,2.520000,40.210000,26.810000,2024-11-15 15:00:00 300916.SZ,朗特智能,29.490000,31.150000,29.400000,30.530000,3804100.000000,115382964.000000,30.700000,144644007.000000,2723000000.000000,30.730000,0.390000,4.120000,36.840000,24.560000,2024-11-15 15:00:00 300917.SZ,特发服务,59.000000,63.990000,58.520000,62.810000,13348800.000000,816309910.000000,65.020000,169000000.000000,9971000000.000000,91.310000,0.840000,7.900000,78.020000,52.020000,2024-11-15 15:00:00 300918.SZ,南山智尚,11.200000,11.880000,11.200000,11.700000,4164700.000000,48103841.000000,11.760000,360041687.000000,4032000000.000000,24.280000,0.640000,1.160000,14.110000,9.410000,2024-11-15 15:00:00 300919.SZ,中伟股份,41.080000,43.060000,41.080000,42.350000,10561400.000000,443550556.000000,42.630000,937089814.000000,37375000000.000000,21.810000,0.660000,1.160000,51.160000,34.100000,2024-11-15 15:00:00 300920.SZ,润阳科技,19.050000,19.650000,18.910000,19.060000,1157300.000000,22260911.000000,19.070000,100000000.000000,1225000000.000000,75.340000,0.470000,1.800000,22.880000,15.260000,2024-11-15 15:00:00 300921.SZ,南凌科技,23.400000,23.980000,22.600000,22.600000,6649500.000000,156145069.000000,22.900000,131691805.000000,1858000000.000000,401.840000,1.140000,8.370000,27.480000,18.320000,2024-11-15 15:00:00 300922.SZ,天秦装备,15.290000,15.950000,15.280000,15.810000,4672000.000000,73267771.000000,15.790000,156811200.000000,1760000000.000000,65.980000,0.420000,4.060000,18.950000,12.630000,2024-11-15 15:00:00 300923.SZ,研奥股份,21.780000,22.440000,21.630000,22.000000,2165800.000000,47839139.000000,22.090000,78600000.000000,1665000000.000000,68.270000,0.680000,2.830000,26.510000,17.670000,2024-11-15 15:00:00 300925.SZ,法本信息,30.000000,31.500000,28.760000,28.920000,73636600.000000,2234797110.000000,29.200000,428708945.000000,9917000000.000000,87.760000,1.410000,22.280000,35.040000,23.360000,2024-11-15 15:00:00 300926.SZ,博俊科技,22.900000,23.880000,22.890000,23.800000,7428900.000000,173836727.000000,23.920000,404753933.000000,6147000000.000000,18.910000,0.680000,2.770000,28.700000,19.140000,2024-11-15 15:00:00 300927.SZ,江天化学,18.620000,19.780000,18.590000,19.400000,3669600.000000,70073532.000000,19.520000,144360000.000000,2623000000.000000,59.310000,0.620000,2.600000,23.420000,15.620000,2024-11-15 15:00:00 300928.SZ,华安鑫创,38.700000,41.210000,38.700000,40.290000,4980900.000000,198384818.000000,41.000000,80000000.000000,2052000000.000000,-58.750000,0.870000,9.400000,49.200000,32.800000,2024-11-15 15:00:00 300929.SZ,华骐环保,9.680000,10.130000,9.670000,9.970000,3270000.000000,32359572.000000,9.980000,132132956.000000,1192000000.000000,-78.160000,0.810000,2.660000,11.980000,7.980000,2024-11-15 15:00:00 300930.SZ,屹通新材,28.600000,29.180000,26.730000,27.400000,6139200.000000,174274825.000000,27.390000,100000000.000000,1348000000.000000,53.710000,1.100000,13.030000,32.870000,21.910000,2024-11-15 15:00:00 300931.SZ,通用电梯,6.930000,7.150000,6.880000,7.030000,5117600.000000,36136086.000000,7.010000,240146000.000000,1361000000.000000,149.200000,0.840000,2.610000,8.410000,5.610000,2024-11-15 15:00:00 300932.SZ,三友联众,13.530000,13.820000,13.240000,13.690000,4983300.000000,67660344.000000,13.690000,228645713.000000,2203000000.000000,45.090000,0.750000,3.060000,16.430000,10.950000,2024-11-15 15:00:00 300933.SZ,中辰股份,6.740000,7.020000,6.730000,6.900000,11991400.000000,82659583.000000,6.900000,458519524.000000,3090000000.000000,48.590000,0.930000,2.620000,8.280000,5.520000,2024-11-15 15:00:00 300935.SZ,盈建科,21.880000,23.240000,21.710000,21.920000,2910000.000000,65655813.000000,22.030000,79430680.000000,1319000000.000000,-34.600000,1.230000,4.830000,26.440000,17.620000,2024-11-15 15:00:00 300936.SZ,中英科技,45.250000,47.460000,45.250000,46.660000,1851300.000000,86229808.000000,47.100000,75200000.000000,2148000000.000000,91.120000,0.590000,3.900000,56.520000,37.680000,2024-11-15 15:00:00 300937.SZ,药易购,31.500000,32.600000,29.500000,30.420000,11328600.000000,351768809.000000,30.810000,95666682.000000,1973000000.000000,162.230000,1.000000,18.080000,36.970000,24.650000,2024-11-15 15:00:00 300938.SZ,信测标准,21.790000,22.550000,21.760000,22.330000,2012200.000000,44645801.000000,22.300000,161225135.000000,2456000000.000000,18.420000,0.600000,1.790000,26.760000,17.840000,2024-11-15 15:00:00 300939.SZ,秋田微,31.700000,32.940000,31.670000,32.300000,2546100.000000,82597911.000000,32.590000,120000000.000000,3804000000.000000,39.020000,0.620000,2.120000,39.110000,26.070000,2024-11-15 15:00:00 300940.SZ,南极光,16.210000,16.950000,16.180000,16.460000,7383100.000000,121676259.000000,16.520000,222644372.000000,2390000000.000000,-1751.860000,0.550000,5.010000,19.820000,13.220000,2024-11-15 15:00:00 300941.SZ,创识科技,23.700000,26.080000,23.700000,26.080000,16521400.000000,412468100.000000,25.060000,204750000.000000,2874000000.000000,128.610000,0.790000,13.620000,30.070000,20.050000,2024-11-15 15:00:00 300942.SZ,易瑞生物,8.590000,8.930000,8.590000,8.780000,4748800.000000,41577182.000000,8.800000,400866877.000000,3443000000.000000,662.720000,0.710000,1.180000,10.560000,7.040000,2024-11-15 15:00:00 300943.SZ,春晖智控,13.370000,13.810000,13.330000,13.560000,4591800.000000,62568810.000000,13.570000,203820000.000000,1796000000.000000,51.770000,0.570000,3.420000,16.280000,10.860000,2024-11-15 15:00:00".to_string();
			let str_split:Vec<&str> = data.split(" ").collect();
			for i in 0..str_split.len(){
				let sub_str = str_split[i];
				let sub_str_split:Vec<&str> = sub_str.split(",").collect();
				if sub_str_split.len() > 5{
					let mut grid_row:FCGridRow = FCGridRow::new();
					let mut cell1:FCGridCell = FCGridCell::new();
					cell1.value = (i + 1).to_string();
					cell1.back_color = String::from("rgb(0,0,0)");
					cell1.text_color = String::from("rgb(190,190,235)");
					cell1.border_color = String::from("none");
					grid_row.cells.push(cell1);
						
					let mut cell2:FCGridCell = FCGridCell::new();
					cell2.value = sub_str_split[0].to_string();
					cell2.back_color = String::from("rgb(0,0,0)");
					cell2.text_color = String::from("rgb(194,151,18)");
					cell2.border_color = String::from("none");
					grid_row.cells.push(cell2);
						
					let mut cell3:FCGridCell = FCGridCell::new();
					cell3.value = sub_str_split[1].to_string();
					cell3.back_color = String::from("rgb(0,0,0)");
					cell3.text_color = String::from("rgb(190,190,235)");
					cell3.border_color = String::from("none");
					grid_row.cells.push(cell3);
					
					let close = sub_str_split[2].to_string().parse::<f64>().unwrap();
					let high = sub_str_split[3].to_string().parse::<f64>().unwrap();
					let low =  sub_str_split[4].to_string().parse::<f64>().unwrap();
					let last_close = sub_str_split[8].to_string().parse::<f64>().unwrap();
						
					let mut cell4:FCGridCell = FCGridCell::new();
					cell4.value = to_fixed(close, 2);
					cell4.back_color = String::from("rgb(0,0,0)");
					cell4.text_color = get_price_color(close, last_close);
					cell4.border_color =  String::from("none");
					grid_row.cells.push(cell4);

					let mut diff = 0.0;
					if last_close > 0.0{
						diff = 100.0 * (close - last_close) / last_close;
					}
						
					let mut cell5:FCGridCell = FCGridCell::new();
					cell5.value = to_fixed(close, 2) + "%";
					cell5.back_color = String::from("rgb(0,0,0)");
					cell5.text_color = get_price_color(close, last_close);
					cell5.border_color = String::from("none");
					grid_row.cells.push(cell5);
						
					let mut cell6:FCGridCell = FCGridCell::new();
					cell6.value = to_fixed(close - last_close, 2);
					cell6.back_color = String::from("rgb(0,0,0)");
					cell6.text_color = get_price_color(close, last_close);
					cell6.border_color = String::from("none");
					grid_row.cells.push(cell6);

					let volume = sub_str_split[6].to_string().parse::<f64>().unwrap();
                    let amount = sub_str_split[7].to_string().parse::<f64>().unwrap();

					let mut cell7:FCGridCell = FCGridCell::new();
					cell7.value = to_fixed(volume / 100.0 / 10000.0, 2) + "万";
					cell7.back_color = String::from("rgb(0,0,0)");
					cell7.text_color = String::from("rgb(190,190,235)");
					cell7.border_color = String::from("none");
					grid_row.cells.push(cell7);

					let mut cell8:FCGridCell = FCGridCell::new();
					cell8.value = to_fixed(amount / 100000000.0, 2) + "亿";
					cell8.back_color = String::from("rgb(0,0,0)");
					cell8.text_color = String::from("rgb(190,190,235)");
					cell8.border_color = String::from("none");
					grid_row.cells.push(cell8);

					let mut cell9:FCGridCell = FCGridCell::new();
					cell9.value = to_fixed(sub_str_split[12].to_string().parse::<f64>().unwrap(), 2);
					cell9.back_color = String::from("rgb(0,0,0)");
					cell9.text_color = String::from("rgb(190,190,235)");
					cell9.border_color = String::from("none");
					grid_row.cells.push(cell9);

					let mut cell10:FCGridCell = FCGridCell::new();
					cell10.value = to_fixed(sub_str_split[11].to_string().parse::<f64>().unwrap(), 2);
					cell10.back_color = String::from("rgb(0,0,0)");
					cell10.text_color = String::from("rgb(190,190,235)");
					cell10.border_color = String::from("none");
					grid_row.cells.push(cell10);

					let mut diff2 = 0.0;
					if last_close > 0.0{
						diff2 = 100.0 * (high - last_close) / last_close - 100.0 * (low - last_close) / last_close;
					}

					let mut cell11:FCGridCell = FCGridCell::new();
					cell11.value = to_fixed(diff2, 2) + "%";
					cell11.back_color = String::from("rgb(0,0,0)");
					cell11.text_color = String::from("rgb(190,190,235)");
					cell11.border_color = String::from("none");
					grid_row.cells.push(cell11);

					let mut cell12:FCGridCell = FCGridCell::new();
					cell12.value = to_fixed(sub_str_split[13].to_string().parse::<f64>().unwrap(), 2);
					cell12.back_color = String::from("rgb(0,0,0)");
					cell12.text_color = String::from("rgb(190,190,235)");
					cell12.border_color = String::from("none");
					grid_row.cells.push(cell12);

					let market_value = sub_str_split[9].to_string().parse::<f64>().unwrap() * close;

					let mut cell13:FCGridCell = FCGridCell::new();
					cell13.value = to_fixed(market_value / 100000000.0, 2) + "亿";
					cell13.back_color = String::from("rgb(0,0,0)");
					cell13.text_color = String::from("rgb(190,190,235)");
					cell13.border_color = String::from("none");
					grid_row.cells.push(cell13);

					let flow_value = sub_str_split[10].to_string().parse::<f64>().unwrap() * close;
					let mut cell14:FCGridCell = FCGridCell::new();
					cell14.value = to_fixed(flow_value / 100000000.0, 2) + "亿";
					cell14.back_color = String::from("rgb(0,0,0)");
					cell14.text_color = String::from("rgb(190,190,235)");
					cell14.border_color = String::from("none");
					grid_row.cells.push(cell14);

					let mut cell15:FCGridCell = FCGridCell::new();
					cell15.value = "".to_string();
					cell15.back_color = String::from("rgb(0,0,0)");
					cell15.text_color = String::from("rgb(190,190,235)");
					cell15.border_color = String::from("none");
					grid_row.cells.push(cell15);

					let upper_limit =  sub_str_split[14].to_string().parse::<f64>().unwrap();
                    let lower_limit =  sub_str_split[15].to_string().parse::<f64>().unwrap();

					let mut cell16:FCGridCell = FCGridCell::new();
					cell16.value = to_fixed(upper_limit, 2);
					cell16.back_color = String::from("rgb(0,0,0)");
					cell16.text_color = String::from("rgb(190,190,235)");
					cell16.border_color = String::from("none");
					grid_row.cells.push(cell16);

					let mut cell17:FCGridCell = FCGridCell::new();
					cell17.value = to_fixed(lower_limit, 2);
					cell17.back_color = String::from("rgb(0,0,0)");
					cell17.text_color = String::from("rgb(190,190,235)");
					cell17.border_color = String::from("none");
					grid_row.cells.push(cell17);

					let mut cell18:FCGridCell = FCGridCell::new();
					cell18.value = "".to_string();
					cell18.back_color = String::from("rgb(0,0,0)");
					cell18.text_color = String::from("rgb(190,190,235)");
					cell18.border_color = String::from("none");
					grid_row.cells.push(cell18);

					let mut cell19:FCGridCell = FCGridCell::new();
					cell19.value = "".to_string();
					cell19.back_color = String::from("rgb(0,0,0)");
					cell19.text_color = String::from("rgb(190,190,235)");
					cell19.border_color = String::from("none");
					grid_row.cells.push(cell19);

					let mut cell20:FCGridCell = FCGridCell::new();
					cell20.value = "".to_string();
					cell20.back_color = String::from("rgb(0,0,0)");
					cell20.text_color = String::from("rgb(190,190,235)");
					cell20.border_color = String::from("none");
					grid_row.cells.push(cell20);

					let mut cell21:FCGridCell = FCGridCell::new();
					cell21.value = "".to_string();
					cell21.back_color = String::from("rgb(0,0,0)");
					cell21.text_color = String::from("rgb(190,190,235)");
					cell21.border_color = String::from("none");
					grid_row.cells.push(cell21);

					let mut cell22:FCGridCell = FCGridCell::new();
					cell22.value = "".to_string();
					cell22.back_color = String::from("rgb(0,0,0)");
					cell22.text_color = String::from("rgb(190,190,235)");
					cell22.border_color = String::from("none");
					grid_row.cells.push(cell22);
						
					gridStocks.rows.push(grid_row);
				}
			}
			break;
		}
	}		
	add_chart(find_view_by_name("mainChart1".to_string(), top_views.clone()).clone(), 0);
	add_chart(find_view_by_name("mainChart2".to_string(), top_views.clone()).clone(), 5);
	add_chart(find_view_by_name("mainChart3".to_string(), top_views.clone()).clone(), 1440);
	add_chart(find_view_by_name("chart1".to_string(), top_views.clone()).clone(), 1);
	add_chart(find_view_by_name("chart2".to_string(), top_views.clone()).clone(), 5);
	add_chart(find_view_by_name("chart3".to_string(), top_views.clone()).clone(), 10);
	add_chart(find_view_by_name("chart4".to_string(), top_views.clone()).clone(), 20);
	add_chart(find_view_by_name("chart5".to_string(), top_views.clone()).clone(), 30);
	add_chart(find_view_by_name("chart6".to_string(), top_views.clone()).clone(), 60);
	add_chart(find_view_by_name("chart7".to_string(), top_views.clone()).clone(), 1440);
	add_chart(find_view_by_name("chart8".to_string(), top_views.clone()).clone(), 10080);
	add_chart(find_view_by_name("chart9".to_string(), top_views.clone()).clone(), 43200);

	update_view_default(top_views.clone());
	invalidate(&context);
    let closure = Closure::wrap(Box::new(move |_event: web_sys::Event| {
        let window3 = web_sys::window().expect("should have a window in this context");
        let document3 = window3.document().expect("window should have a document");
        unsafe{
            let device_pixel_ratio = window3.device_pixel_ratio();
            M_CANVAS_WIDTH = document3.document_element().expect("REASON").client_width() as f32;
            M_CANVAS_HEIGHT = document3.document_element().expect("REASON").client_height() as f32;
            canvas.set_width((M_CANVAS_WIDTH * device_pixel_ratio as f32) as u32);
		    canvas.set_height((M_CANVAS_HEIGHT * device_pixel_ratio as f32) as u32);
		    canvas.style().set_property(&("width".to_string()), &(M_CANVAS_WIDTH.to_string() + "px")).unwrap();
		    canvas.style().set_property(&("height".to_string()), &(M_CANVAS_HEIGHT.to_string() + "px")).unwrap();
        }
	    context.scale(device_pixel_ratio, device_pixel_ratio).unwrap();
        let top_views3 = get_top_views();
	    update_view_default(top_views3);
        invalidate(&context);
    }) as Box<dyn FnMut(_)>);
    let window2 = web_sys::window().expect("should have a window in this context");
    window2.add_event_listener_with_callback("resize", closure.as_ref().unchecked_ref()).unwrap();
    closure.forget();

    let input: web_sys::HtmlInputElement = document.create_element("input").unwrap().dyn_into().unwrap();
    input.set_type("text");
    input.set_attribute("id", "RUSTINPUTTEXT").unwrap();
    input.style().set_property("position", "absolute").unwrap();
    input.style().set_property("display", "none").unwrap();
    input.style().set_property("box-sizing", "border-box").unwrap();
    document.body().unwrap().append_child(&input)?;

    Ok(())
    //wasm-pack build --release --target web
}
